-- ejercicio 6
elemNum :: Int -> [Int] -> Int
elemNum x ys = sum [1 | y <- ys, y == x]

elemNum1 :: Int -> [Int] -> Int
elemNum1 _ [] = 0
elemNum1 x (y:ys)
		| x == y	= 1 + elemNum1 x ys
		| otherwise = elemNum1 x ys

-- ejercicio 7
unique :: [Int] -> [Int]		
unique xs = [x | x <- xs, (elemNum x xs) == 1]

-- ejercicio 8
reverse1 :: [a] -> [a]
reverse1 [] = []
reverse1 (x:xs) = reverse1 xs ++ [x]

-- ejercicio 8
ins :: Int -> [Int] -> [Int]
ins x [] = [x]
ins x (y:ys)
	| x <= y 	= x : (y:ys)
	| otherwise = y : ins x ys

iSort :: [Int] -> [Int]
iSort [] = []
iSort (x:xs) = ins x (iSort xs)

minmax :: [Int] -> (Int, Int)
minmax [] = (0,0)
minmax xs = (head(ys), last(ys))
	where ys = iSort xs